package com.mzsoft.ai.util;

import java.util.HashMap;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.alibaba.fastjson.JSON;

/**
 * 读取excel模板数据(表字段和excel标题对应字段在模板配置)
 * @author libq
 *
 */
public class ReadTemplate2Data {

    private static Logger logger = LoggerFactory.getLogger(ReadTemplate2Data.class);

    public static Map<String,Object> readMultiSheetData(String filePath) {

        //最终结果
        Map<String,Object> result = new HashMap<>();

        //读取单位excel
        try {
            //读取excel文件中多个sheet
            logger.debug("Template Data read Sheet.....");
            Map<String, Object> excelMultiSheetMap = ExcelUtil.readExcelMultiSheetMap(filePath,2);
            logger.debug("result:"+JSON.toJSONString(excelMultiSheetMap));
            return excelMultiSheetMap;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return result;
    }
}
